import requests

__author__ = 'yangxianming'
#核心后管接口测试实例

import pymysql

#普通的接口请求
# url = "http://www.baidu.com"
# r = requests.get(url)
# print(r.content)

#上传文件
url = "http://koufudev.e-fuli.com:8081/merchantShop/welfarecardShop/upload"
#巨坑，上传文件的时候header中不要设置Content-Type，服务器会找不到文件
headers = {"Cookie":"JSESSIONID=D22DC5DAAF2F72CFC0872EA44961CAFC"}
dataPath = r"D:\javaWorkSpace\testServerNode\web\python\test\data\xxx.xlsx"

# files = {'file':open(dataPath,'rb'),'filename':'xxx.xlsx','Content-Type':'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'}
files = {'file':('xxx.xlsx',open(dataPath,'rb'),'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')}
r = requests.post(url,files=files, headers=headers,verify=False)
print(r.content.decode("utf-8"))